package remoto;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

import dominio.Factura;

public class GestionFacturas {
	private static GestionFacturas instance;

	public static GestionFacturas getInstance() throws MalformedURLException, RemoteException, NotBoundException {
		if (instance == null)
			instance = new GestionFacturas();
		return instance;
	}

	private IGestionFacturas remoto;

	private GestionFacturas() throws MalformedURLException, RemoteException, NotBoundException {
		remoto = (IGestionFacturas) Naming.lookup("GestionFacturas");
	}

	public int guardarFactura(Factura factura) throws RemoteException {
		return remoto.guardarFactura(factura.getDTO());
	}
}